package com.tencent.mm.opensdk.modelmsg;

import android.os.Bundle;
import android.util.Log;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;

public final class SendAuth {
    public static class Req extends BaseReq {
        private static final int LENGTH_LIMIT = 1024;
        private static final String TAG = "MicroMsg.SDK.SendAuth.Req";
        public String scope;
        public String state;

        public Req() {

        }

        public Req(Bundle arg1) {

            this.fromBundle(arg1);
        }

        public boolean checkArgs() {
            int v2 = 1024;
            boolean v0 = false;
            if(this.scope == null || this.scope.length() == 0 || this.scope.length() > v2) {
                Log.e("MicroMsg.SDK.SendAuth.Req", "checkArgs fail, scope is invalid");
            }
            else {
                if(this.state != null && this.state.length() > v2) {
                    Log.e("MicroMsg.SDK.SendAuth.Req", "checkArgs fail, state is invalid");
                    return v0;
                }

                v0 = true;
            }

            return v0;
        }

        public void fromBundle(Bundle arg2) {
            super.fromBundle(arg2);
            this.scope = arg2.getString("_wxapi_sendauth_req_scope");
            this.state = arg2.getString("_wxapi_sendauth_req_state");
        }

        public int getType() {
            return 1;
        }

        public void toBundle(Bundle arg3) {
            super.toBundle(arg3);
            arg3.putString("_wxapi_sendauth_req_scope", this.scope);
            arg3.putString("_wxapi_sendauth_req_state", this.state);
        }
    }

    public static class Resp extends BaseResp {
        private static final int LENGTH_LIMIT = 1024;
        private static final String TAG = "MicroMsg.SDK.SendAuth.Resp";
        public String code;
        public String country;
        public String lang;
        public String state;
        public String url;

        public Resp() {

        }

        public Resp(Bundle arg1) {

            this.fromBundle(arg1);
        }

        public boolean checkArgs() {
            boolean v0;
            if(this.state == null || this.state.length() <= 1024) {
                v0 = true;
            }
            else {
                Log.e("MicroMsg.SDK.SendAuth.Resp", "checkArgs fail, state is invalid");
                v0 = false;
            }

            return v0;
        }

        public void fromBundle(Bundle arg2) {
            super.fromBundle(arg2);
            this.code = arg2.getString("_wxapi_sendauth_resp_token");
            this.state = arg2.getString("_wxapi_sendauth_resp_state");
            this.url = arg2.getString("_wxapi_sendauth_resp_url");
            this.lang = arg2.getString("_wxapi_sendauth_resp_lang");
            this.country = arg2.getString("_wxapi_sendauth_resp_country");
        }

        public int getType() {
            return 1;
        }

        public void toBundle(Bundle arg3) {
            super.toBundle(arg3);
            arg3.putString("_wxapi_sendauth_resp_token", this.code);
            arg3.putString("_wxapi_sendauth_resp_state", this.state);
            arg3.putString("_wxapi_sendauth_resp_url", this.url);
            arg3.putString("_wxapi_sendauth_resp_lang", this.lang);
            arg3.putString("_wxapi_sendauth_resp_country", this.country);
        }
    }

    private SendAuth() {

    }
}

